package com.example.demo.day0224;

public class Percel2 {
    private class PContents implements Contents {//创建一个内部类并实现Contens接口
        private int i = 11;

        public int value() {//重写Contents接口的方法
            return i;
        }
    }

    protected class PDestination implements Destination {
        private String label;

        private PDestination(String whereTo) {
            label = whereTo;
        }

        public String readlabel() {//重写Destination接口的方法
            return label;
        }
    }

    public Destination destination(String s) {
        return new PDestination(s);
    }

    public Contents contents() {
        return new PContents();
    }
}

class TestParcel{
    public static void main(String[] args) {
        Percel2 p=new Percel2();
        Contents c=p.contents();
        Destination d=p.destination("Tasmania");
    }
}

